package com.kg.fiber.common;

public class Sum {
	
    /** */
    private long n;

    /**
     * The currently running sum.
     */
    private double value;

    /**
     * Create a Sum instance
     */
    public Sum() {
        n = 0;
        value = 0;
    }

    public void add(final double d) {
        value += d;
        n++;
    }

    public double getResult() {
        return value;
    }
    
    public double getMean() {
    	return value / (double)n;
    }

    public long getN() {
        return n;
    }

    public void clear() {
        value = 0;
        n = 0;
    }

}
